<%--
  Created by IntelliJ IDEA.
  User: 31525
  Date: 10/13/2023
  Time: 5:49 PM
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
<input type="file" id="imageFile" accept="image/*">
<button onclick="uploadImage()">Upload</button>
</body>
<script>
    function uploadImage() {
        const fileInput = document.getElementById('imageFile');
        const file = fileInput.files[0];
        const formData = new FormData();
        formData.append('image', file);
        fetch('/upload', {
            method: 'POST',
            body: formData
        }).then(response => {
            // 处理响应
        }).catch(error => {
            // 处理错误
        });
    }

</script>
</html>
